home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / WILDCAT.SLT < prev   
Text File  |  1992-03-20  |  13KB  |  390 lines

  1. //-----------------------------------------------------------
  2. // WILDCAT.SL? Automatic logging into an WILDCAT! system.
  3. //
  4. // Please look at the comments through the whole file, and modify to
  5. // suit your needs, BEFORE you use it. Then recompile with CS WILDCAT.
  6. //-----------------------------------------------------------
  7.  
  8. // If you have suggestions for improving this script, please suggest
  9. // improvements to me via old-fashioned snail-mail to:
  10.  
  11. // Author:  Inge Vabekk
  12. //          Hamangskogen 108
  13. //          N-1300 SANDVIKA
  14. //          NORWAY
  15. //          tel. (472) 546 396
  16.  
  17. str thisBBStype[] = "WILDCAT"// This BBS type.      
  18.    ,line      [80]           // General input line.
  19.    ,filelist  [12]           // Name of file list for this BBS.
  20.    ,myprot     [2]           // Chosen protocol.
  21.    ,hisprot    [2]           // WILDCAT's translation.
  22.    ,mypass    [24]           // My password
  23.    ,User      [24]           // My user name
  24.  
  25.                              // For the Global storage:
  26.    ,global   []="GLOBAL"     // Global script.
  27.    ,bbstype  []="BTYPE"      // BBS type.
  28.    ,short    []="SHORT"      // Short BBS name.
  29.    ,cprot    []="CPROT"      // Current protocol.
  30.    ,hprot    []="HPROT"      // WILDCAT's interpretation of protocol
  31.    ,prompt   []="PROMPT"     // Current prompt (global name)
  32.    ,username []="NAME"       // User name.
  33.    ,alias    []="ALIAS"      // User alias.
  34.    ,passw    []="PASSW"      // Current password.
  35.    ,addr     []="ADDR"       // Address
  36.    ,mail     []="MAIL"       // Mail address
  37.    ,stabb    []="STABB"      // State abbreviation
  38.    ,zip      []="ZIP"        // Zip code
  39.    ,bdate    []="BDATE"      // Birth date
  40.    ,sex      []="SEX"        // Your sex.
  41.    ,hfone    []="HTEL"       // Home phone
  42.    ,Dback    []="DBACK"      // Dial-back number
  43.    ,mscript  []="MDOOR"      // Name of mail door.
  44.    ,mailup   []="MAILUP"     // Name of upload mail script.
  45.    ,Update   []="UPDATE$"    // Name of update program.
  46.    ,command[10]              // Current prompt (value)
  47.    ;     
  48.  
  49. int tol = 300                // No activity for 30 seconds?
  50.    ,stat, tmark
  51.    ,t1, t2, t3, t4, t5, t6   // For tracking.        
  52.    ,t7, t8, t9, t10          // For tracking.        
  53.    ;
  54.  
  55. //-----------------------------------------------------------   
  56. // Script starts here.
  57. //-----------------------------------------------------------   
  58.  
  59. main()
  60. {
  61. int error;
  62.  
  63.   entry();                               // Updates colors & status bar. 
  64.  
  65. // Only if online.
  66.  
  67.   if (!carrier())  
  68.   { failtone();
  69.     status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  70.     return (-1);
  71.   }
  72.  
  73.   read (bbstype,line);                   // Get current BBS type.
  74.   if (line != thisBBStype)  
  75.   { wrongBBS();                          // Doesn't match script!
  76.     return (-1);
  77.   }
  78.  
  79.   error = 1;
  80.   read (username,User);                  // Get the user name.
  81.   command = " Command?";                 // Set WILDCAT command prompt.
  82.   write (prompt,command);
  83.   write (mscript,mailup);                // Next script.
  84.  
  85. // Start tracking.
  86.  
  87. again:
  88.   t1 = track ("your first name ?",0);    // Name.
  89.   t2 = track ("N]onStop? [",0);          // Nonstop?
  90.   t3 = track ("rrectly ? [",0);          // Spelt correctly?
  91.   t4 = track ("Password? [",0);          // Password?
  92.  
  93.   tmark = timer_start (tol);             // Wait a minute for login
  94.   if (error) cputs ("^M");               // Proceed.
  95.  
  96.   while ((stat=trig()) > 0)
  97.   { if (stat == t1)                      // Want name?
  98.     { cputs (User);
  99.       cputs ("^M");
  100.     }
  101.     else if (stat == t2)                 // Non Stop?
  102.       cputs ("^M");
  103.     else if (stat == t3)
  104.     { release();
  105.       error = register();                // Register?
  106.       if (!error) goto again;
  107.     }
  108.     else if (stat == t4)                 // Password:
  109.     { read (passw,mypass);               // Read password.
  110.       cputs (mypass);                    // Send password.
  111.       cputs ("^M");
  112.     }
  113.     if (!error) break;
  114.   }
  115.   release();                             // Release tracks and timer.
  116.   if (!carrier()) return (-1);
  117.  
  118.   t1 = track ("letin menu? [",0);        // View bulletin menu?
  119.   t2 = track ("[N]onStop? [",0);         // Nonstop?
  120.   t3 = track ("to Quit: ? [",0);         // Enter to quit.
  121.   t4 = track ("to continue?",0);         // Enter to continue. 
  122.   t5 = track (command,0);                // Command prompt.
  123.  
  124.   tmark = timer_start (tol);             // Wait a minute for login
  125.  
  126.   while ((stat=trig()) > 0)
  127.   { if (stat == t1)                      // Want bulletin menu?
  128.       cputs ("n^M");                     // No.
  129.     else if (stat==t2 || stat==t3        // Enter to continue
  130.       || stat == t4)
  131.       cputs ("^M");
  132.   }
  133.   release();                             // Release tracks and timer.
  134.   if (!carrier()) return (-1);
  135.  
  136.   t1 = track ("[N]onStop? [",0);         // Nonstop?
  137.  
  138.   tmark = timer_start (tol);             // Wait a minute.
  139.  
  140.   while ((stat=trig()) > 0)              // Wait here.
  141.   { cputs ("^M");
  142.   }
  143.   release();
  144.   return (0);                            // Return.
  145. }
  146.  
  147. //-----------------------------------------------------------
  148. // Register on WildCat!
  149. //-----------------------------------------------------------
  150.  
  151. register()
  152. {
  153. int i, j;
  154.  
  155.   terminal();                            // Update screen.
  156.   i = gety();                            // All lines on screen:
  157.   while (i >=0 )
  158.   { vgetchrs(0,--i,line,0,60);           // Get the line.
  159.     setchr (line,60,0);
  160.     if (strposi(line,user,0) > 0) 
  161.       break;
  162.   }
  163.   if (i<=0)                              // Name correct?
  164.   { cputs ("N^M");                       // No, return for retry.
  165.     return(0);
  166.   }
  167.  
  168. // Register on this BBS.
  169.  
  170.   t1 = track ("password? [",0);
  171.   t2 = track ("o verify? [",0);
  172.  
  173.   tmark = timer_start (tol);             // Set timeout.
  174.   cputs ("Y^M");                         // Answer Yes.
  175.  
  176.   while ((stat=trig()) > 0)
  177.   { read (passw,mypass);                 // Read password.
  178.     cputs (mypass);                      // Send password.
  179.     if (stat == t2) break;
  180.     cputs ("^M");
  181.   }
  182.   release();                             // Release tracks and timer.
  183.   if (!carrier()) return (-1);
  184.  
  185.   t1 = track (" [N]onStop? [",0);        // Nonstop?
  186.   t2 = track ("reet address?",0);        // Street address
  187.   t3 = track ("line (if any)",0);        // Second line
  188.   t4 = track (" you live in?",0);        // What city?
  189.   t5 = track ("r your state?",0);        // Abbreviation for state
  190.   t6 = track ("our zip code?",0);        // Zip code
  191.   t7 = track ("ate of birth?",0);        // Birth date
  192.   t8 = track ("home phone nu",0);        // Home phone number
  193.   t9 = track ("data phone nu",0);        // Data phone number
  194.   t10= track ("le or Female?",0);        // Your gender please?
  195.  
  196.   tmark = timer_start (tol);             // Set timeout.
  197.   cputs ("^M");                          // Continue.
  198.  
  199.   while ((stat=trig()) > 0)
  200.   { if (stat == t1)
  201.       cputs ("^M");
  202.     else if (stat == t2)                 // Street address.
  203.       output (addr);
  204.     else if (stat == t3)                 // Postal code
  205.       output (mail);
  206.     else if (stat == t4)                 // City
  207.     { for (i=0; (j=subchr(line,i)) > 0; ++i)
  208.       { if (j >='A') cputc (j);          // Send only letters.
  209.         if (j < 32) break;
  210.       }
  211.       cputs ("^M");
  212.     }
  213.     else if (stat == t5)                 // State abbreviation
  214.       output (stabb);
  215.     else if (stat == t6)                 // Zip code
  216.       output (zip);
  217.     else if (stat == t7)                 // Birth date
  218.       output (bdate);
  219.     else if (stat == t8)                 // Home phone
  220.       output (hfone);
  221.     else if (stat == t9)                 // Data phone
  222.       output (dback);
  223.     else if (stat == t10)                // Gender
  224.       break;
  225.   }
  226.   release();                             // Release tracks and timer.
  227.   if (!carrier()) return (-1);
  228.  
  229.   t1 = track ("ish to use? [",0);        // Alias?
  230.   t2 = track ("C X K A]: ? [",0);        // Select protoco